package com.appkubes.fintech.admin.application.repair;

import com.appkubes.fintech.admin.application.bill.entity.dto.BillReportDTO;
import com.appkubes.fintech.admin.application.bill.entity.dto.BillReportVO;
import com.appkubes.fintech.admin.application.bill.entity.dto.RentBillHeaderDTO;
import com.appkubes.fintech.admin.application.bill.entity.dto.RepayVO;
import com.appkubes.fintech.admin.application.bill.entity.vo.RentBillHeaderRequest;
import com.appkubes.fintech.admin.application.bill.service.RentBillHeaderService;
import com.appkubes.fintech.admin.application.repair.request.RepairChannelRequest;
import com.appkubes.fintech.admin.application.repair.response.ChannelItemResponse;
import com.appkubes.fintech.admin.application.repair.service.RepairChannelService;
import com.appkubes.fintech.common.response.Response;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

/*
 *
 * @author xqc
 * @date 	2020/01/03 19:02:40
 */
@RestController
@RequestMapping("repair/channel")
@Api(tags = "账单列表", value = "ChannelController")
@Slf4j
public class ChannelController {

    @Autowired
    private RepairChannelService channelService;


    @ApiOperation(tags = "分页账单列表", value = "queryPage")
    @PostMapping(value = "queryPage")
    public Response<PageInfo<ChannelItemResponse>> queryPage(@RequestBody RepairChannelRequest request) {

        PageInfo<ChannelItemResponse> pageInfo = channelService.queryPage(request);
        return Response.success(pageInfo);
    }

    @ApiOperation(tags = "添加类别", value = "update")
    @PostMapping(value = "save")
    public Response save(@RequestBody RepairChannelRequest rentBillHeaderRequest) {

        return channelService.save(rentBillHeaderRequest);
    }

    @ApiOperation(tags = "更新账单列表", value = "update")
    @PostMapping(value = "update")
    public Response update(@RequestBody RepairChannelRequest rentBillHeaderRequest) {

        return channelService.update(rentBillHeaderRequest);
    }

    @ApiOperation(tags = "删除账单列表", value = "delete")
    @GetMapping(value = "delete")
    public Response delete(String id) {
        return channelService.delete(id);
    }

    @ApiOperation(tags = "获取账单列表", value = "getById")
    @GetMapping(value = "getById")
    public Response<ChannelItemResponse> getById(String id) {
        return channelService.getById(id);

    }


}
